package project.menu.ordermenu;

import project.controllers.Controller;
import project.controllers.Messager;
import project.controllers.Printer;
import project.menu.IMenu;
import project.menu.IMenuItem;
import project.work.Navigator;
import controllers.IAutoservice;
import entities.IOrder;

public class OrderByMaster implements IMenuItem {

	private String name= "Get order by master";
	private final Integer id= 2;
	private static IMenu submenu;
	private Controller controller;
	private Navigator navigator;
	
	public OrderByMaster(){
		controller=Controller.getInstance();
		navigator=Navigator.getInstance();
	}
		
	public Integer getId() {
		return id;
	}
	
	public void action(IAutoservice autoservice) {
		//getmasterbyorder
		IOrder order=autoservice.getOrderByMaster(controller.getMasterName());
		Printer.printMessage(Messager.MASTER_PERFORMS_ORDER+order.getNumberOrder());
		navigator.drawMenu(submenu);
	}

	
	public String getNameItem() {
		
		return name;
	}

	
	public static void setSubmenu(IMenu menu){
		 submenu=menu;
	}

}
